
/**
 * AJAX 载入用户上传图片页面
 *
 * @return 	void
 */
function bindUserNewPhoto() {
	var uploadBoxObj = document.getElementById("user-body-box");
	uploadBoxObj.uploaded = function(uploadedResult, success) {
		if(!success) {
			addMmLightBoxMsg(uploadedResult, 1, 1);
		} else {
			addMmLightBoxMsg(uploadedResult, 1, 0, 0, function(){
				window.setTimeout(function(){
					removeMmLightBoxMsg();
				}, 1000);
			});
			$("#uploadFrom").get(0).reset();
		}
	};

	//ajax-upload-link
	$("#ajax-add-photo-link").click(function(){
		$(".slider-item a").removeClass('selected-slider-item');
		$(this).addClass('selected-slider-item').blur();
		addMmLightBoxMsg('Wait a moment please, loading data ...', 0, 0, 1);
		$.get($(this).attr('href'), function(dt){
			$("#user-body-box").height('auto').html(dt);
			reactHeight();
			removeMmLightBoxMsg();
			$("#uploadFrom").submit(function(){
				var imgFile = $("#upfile-input").val();
				var regex = /(jpg|png|gif)$/i;
				if(!regex.test(imgFile)) {
					alert('Sorry! We are just support *.jpg, *.png, *.gif file type!');
					return false;
				}
				addMmLightBoxMsg('Wait a moment please, image file is uploading ...', 0, 0, 1);
				return true;
			});
		});
		return false;
	});
}
